<?php

include_once('../@base/portal.php');
include_once('../login/login.php');

$user = $post->user;
$login = login($user->number, $user->passwd);
if ($login['status'] == 0 && $login['userbase']['level'] > 0) {
  output(doQuery());
} else {
  output(['status' => 1]);
}

function doQuery()
{
  $sql = "SELECT name, clientOffice, clientGroup, clientRank, level FROM oprec_security_data ORDER BY CONVERT( name USING gbk ) COLLATE gbk_chinese_ci ASC";
  $result = exec_sql($sql);
  if ($result) {
    return [
      'status' => 0,
      'content' => $result
    ];
  }
}

/*
SELECT `number`, `name`, `clientName`, `clientOffice`, `clientGroup`, `clientRank`, `passwd`, `level` FROM `oprec_security_data` WHERE 1
*/